﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Xml.Serialization;

namespace nGSO
{//gsov2
    public class NeighborhoodRangeExtender : BaseAfterAgentMoveExtension
    {
        public override string Name
        {
            get { return "NeighborhoodRangeExtender"; }
        }
        
        public override void Apply(Agent agent, GsoConfig config, ObjectiveFunction fitnessFun)
        {   
            if (agent.Neighbors.Count < config.DesiredNoOfNeighbors)
            {
                config.RadialSensorRange *= 1.05;
                agent.History.Last().AppliedGosV2 = true;
                Debug.Write(" to " + agent.NextNeighborhoodRange);
            } 
        }
    }
}
